package cn.tedu.boot041.controller;

import cn.tedu.boot041.entity.Product;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.imageio.plugins.bmp.BMPImageWriteParam;

@RestController
public class AxiosController {
    @RequestMapping("/helloAxios")
    public String helloAxios( String name,int age){
        return "测试成功name="+name+":"+age;
    }
    //如果发出的请求方式是post请求并且传递过来的是自定义JS对象接收参数时需要添加
    //@ResponseBody注解  如果不注解  接收到的参数是null
    @RequestMapping("/postAxios")
    public String postAxios(@RequestBody Product product){

        return "测试成功"+product.toString();
    }

}
